import os
# import re
# str = '''e_u_PID_switch
# e_u_EXV_H_PID_switch
# e_sw_EXV_H_SV
# e_sw_EXV_H_P
# e_sw_EXV_H_I
# e_u_WTC_H_PID_switch
# e_sw_WTC_H_SV
# e_sw_WTC_H_P
# e_sw_WTC_H_I
# e_u_Comp_PID_switch
# e_sw_Comp_SV
# e_sw_Comp_P
# e_sw_Comp_I
# '''
# str_zhushi = '''PID调试功能开关
# 热泵膨胀阀PID系数选择开关
# 热泵电子膨胀阀设定(SV)值
# 热泵电子膨胀阀P系数
# 热泵电子膨胀阀I系数
# 采暖加热器PID系数选择开关
# 采暖加热器设定（SV）值
# 采暖加热器P系数
# 采暖加热器I系数
# 压缩机PID系数选择开关
# 制冷模式压缩机设定值（SV）
# 乘客舱制冷压缩机P系数
# 乘客舱制冷压缩机I系数
# '''
# structVar_name = 'PID_Debug.'
# zhushi_groups = str_zhushi.splitlines()
# var_groups = str.splitlines()
# str_result = 'typedef struct\n{\n'
# fundef_str = '''
# /*------------------------------------------------------------------------------
# | Function Name   : MngSYSIF_($Function_name$)
# | Called by       :
# | Preconditions   :
# | Input Parameters: none
# | Return Value    : none
# | Description     : refresh sensor data from RTE to SysCtrl
# | ------------------------------------------------------------------------------
# | History:
# |   DATE        AUTHOR          Description
# |   ----------  --------------  ------------------------------------------------
# |   2020.03.04  CJL             add new
# ------------------------------------------------------------------------------*/
# TsSYSCTRL_h_($Function_name$)       ($Function_name$);
# static void MngSYSIF_($Function_name$)(void)\n{\n'''
# for index,var in enumerate(var_groups):
#     varLen_type = 'sint16'
#     if ';' in var:
#         var = var.replace(';','')
#     tab_number =7 - (len(var)//4)
#     fundef_tabNum =10 - (len(var + structVar_name)//4)
#     if ('_sw_') in var:
#         varLen_type = 'sint16'
#     elif '_u_' in var:
#         varLen_type = 'uint8'
#     elif '_w_' in var:
#         varLen_type = 'uint16'
#     str_result += '\t' + varLen_type + '\t' +var +'\t'*tab_number + ';/* ' + zhushi_groups[index]+' */\n'
#     fundef_str += '\t' + structVar_name + var + '\t'*fundef_tabNum + '=;\n'
#     fundef_str = fundef_str.replace('($Function_name$)',structVar_name[:-1])
#     index += 1
# str_result += '}TsSYSCTRL_h_'+structVar_name[:-1] + ';'
# fundef_str += '}'
# print(str_result)
# print(fundef_str)
# UnitDict = {'dgc': 10,'℃': 10,'v':10,'V':10,'A':10,'Mpa':100,'km_per_h':1,'rpm':1,'percent':1,'%':1}
# unitRate =UnitDict.get('dgc',1)
# print(unitRate)
# 新特性：格式化输出
# import re
# path = r'C:\Users\chenjianli\Desktop\Hg\D55\输出文档\外部CAN\D55_20200218(SANHUA).dbc'
# with open(path) as f:
#     str_list = f.readlines()
# str = ' SG_ CDU_HVAC_DriverTempSelect : 36|5@0+ (0.5,17.5) [17.5|32] "degC"  HVAC'
# str1 = ' SG_ ICM_TotalOdometer : 15|20@0+ (0.05,0) [0|524287.5] ""  DCDC,OBC,BMS,IPU,HVAC,TCM'
# signal_group1 = re.search(' SG_ (\S+) : \d+\|(\d+)@0\+ \((\d+\.?\d*),(-?\d+\.?\d*)\) \[(-?\d+\.?\d*)\|(-?\d+\.?\d*)\] "(\S+)"*', str).groups()
# signal_group2 = re.search(' SG_ (\S+) : \d+\|(\d+)@0\+ \((\d+\.?\d*),(-?\d+\.?\d*)\) \[(-?\d+\.?\d*)\|(-?\d+\.?\d*)\] "(\S+)"*', str1).groups()
# for line in str_list:
#     try :
#         if re.match(' SG_ (\S+) : \d+\|(\d+)@0\+ \((\d+\.?\d*),(-?\d+\.?\d*)\) \[(-?\d+\.?\d*)\|(-?\d+\.?\d*)\] "(\S+)"*',line) != None:
#             signal_group1 = re.search(' SG_ (\S+) : \d+\|(\d+)@0\+ \((\d+\.?\d*),(-?\d+\.?\d*)\) \[(-?\d+\.?\d*)\|(-?\d+\.?\d*)\] "(\S+)"*', line).groups()
#     except Exception as e:
#         print(e)
# import re
# with open(r'C:\Users\chenjianli\Desktop\Hg\D55\输出文档\外部CAN\ET1\D55_GenyConfigV4.0_ET1\TMC_BCAN_D55_ET1_Matrix_V01_SANHUA.dbc') as f:
#     dbc_str = f.read()
# re_compile_str = r'(?:^BA_ "GenMsgSendType" BO_ {0} \d;.*?|^BA_ "GenMsgSendType" )BO_ {0} \d;.*?BO_ {0} (\d+);'.format(792)
# print(re_compile_str)
# re_compile = re.compile(re_compile_str,flags=re.S|re.M)
# result = re_compile.findall(dbc_str)
# print(result)
print((lambda x,y:x if y==1 else "*"*len(x))('shagsh',2))
